extends patient-bar

block body
	div(class="wrapper")
	div(id="container")
		div(class="wrapper")
			div(class="content")
				h2 Audiometries
				form
					button(ng-click="addAudiometry()") Creer une nouvelle audiometrie
				form
					button(ng-click="getChartObject()") refreshChart
					button(ng-Click="printChartObject()") printChart
				form
					fieldset
						select(ng-model="dateFilter", ng-init="dateFilter = patient.audiometries[0].date" , ng-change="getChartObject()", ng-options="audiometrie.date as audiometrie.date for audiometrie in patient.audiometries")
				
				div(ng-repeat="audiometrie in patient.audiometries | filter:dateFilter", style="width:100%;")
					table
						tbody
							tr
								td
									table
										caption
											h1 Audio du {{audiometrie.date}}
										thead
											th Frequence
											th Aerien Gauche
											th Osseux Gauche
											th Aerien Droite
											th Osseux Droite
										tbody
											tr(ng-repeat="audio in audiometrie.audio")
												td
													input(ng-model="audio.frequence", size="2", ng-change="getChartObject()")
												td
													input(ng-model="audio.aerien_gauche", size="2", ng-change="getChartObject()"))
												td
													input(ng-model="audio.osseux_gauche", size="2", ng-change="getChartObject()"))
												td
													input(ng-model="audio.aerien_droite", size="2", ng-change="getChartObject()"))
												td
													input(ng-model="audio.osseux_droite", size="2", ng-change="getChartObject()"))
								td
									table
										caption
											h1 Graphe du {{audiometrie.date}}
										thead
										tbody
											tr
												td
													div(id="audio_gauche_chart_div", google-chart chart="chartAudio_gauche", style="height:200px; min-width:300px")
												td
													div(id="audio_droite_chart_div", google-chart chart="chartAudio_droite", style="height:200px; min-width:300px")

					table
						tbody
							tr
								td
									table
										caption
											h1 AV du {{audiometrie.date}}
										thead
											th Type
											th Aerien Gauche
											th Osseux Gauche
											th Aerien Droite
											th Osseux Droite
										tbody
											tr(ng-repeat="av in audiometrie.av")
												td
													input(ng-model="av.type", size="2", ng-change="getChartObject()")
												td
													input(ng-model="av.aerien_gauche", size="2", ng-change="getChartObject()"))
												td
													input(ng-model="av.osseux_gauche", size="2", ng-change="getChartObject()"))
												td
													input(ng-model="av.aerien_droite", size="2", ng-change="getChartObject()"))
												td
													input(ng-model="av.osseux_droite", size="2", ng-change="getChartObject()"))
								td
									table
										caption
											h1 Graphe du {{audiometrie.date}}
										tbody
											tr
												td
													div(id="av_gauche_chart_div", google-chart chart="chartAV_gauche", style="height:200px; min-width:300px")
												td
													div(id="av_droite_chart_div", google-chart chart="chartAV_droite", style="height:200px; min-width:300px")


					table
						tbody
							tr
								table
									caption
										h1 Vocal du {{$scope.i = -5;audiometrie.date}}
									thead
										th(ng-repeat="vocal_droite in audiometrie.vocal_droite")
											{{$scope.i = $scope.i+5}}
									tbody
										tr
											td(ng-repeat="vocal_droite in audiometrie.vocal_droite")
												input(ng-model="vocal_droite", size="1")
										tr
											td(ng-repeat="vocal_gauche in audiometrie.vocal_gauche")
												input(ng-model="vocal_gauche", size="1")
							tr
								div(id="vocal_chart_div", google-chart chart="chartVocal", style="height:200px; width:600px")
				
